006 basic controls
欢迎回到本次讲座,我们将开始研究一些基本控件。
Welcome back in this lecture we're going to start looking at some basic controls.
所以在我们右边,我要进来,这里是我们将要使用的一些基本东西。
So over here on our right I'm going to come in here and here are some of the basic things that we're going to be using.
其中之一将是一个按钮。
One of them is going to be a pushbutton.
因此,如果我单击此处的按钮,您可以看到我有很多针对不同类型按钮的不同选择模板,我可以将它们用作按钮,其中一些确实是天生的。
So if I click on push button over here you can see I've got a whole lot of different choices templates for different kind of buttons that I could use as a push button and some of these are just really are innate.
我是一个简单的人。
And I'm a kind of simple guy.
所以我喜欢简单的事情。
So I like simple things.
我将拖入示例 20,然后将其放在这里,并且我已经从上一讲中设置了一些标签。
I'm just going to drag in the sample 20 and I'm going to put that over here and I've already got some tags set up from a previous lecture.
因此,就我想使用的标签而言,我将使用我的状态标签,也许是 3 0 0,所以现在我已经链接到一些东西,我可以更改其上的文本以使其显示关闭或打开。
So as far as what tag I want to use I'm going to use my status tag maybe 3 0 0 so now I've linked to something I can change the text on this to make it say off or on.
在这种情况下,我只需更改它并说出状态,我将复制它并将其粘贴到此处,因为我将使用此按钮作为瞬时打开。
And in this case I'm just going to change it and say status and I will copy that and paste it here as well because I'm going to be using this button as a momentary on.
因此,如果我在按下按钮时使用它作为切换,一旦我再次按下按钮时它改变了位,我不想将其用作切换。
So I don't want to use this as a toggle if I use this as a toggle when I push the button once it changes the bit on when I push the button again.
它将其更改回关闭状态并来回移动。
It changes it back to off and goes back and forth.
好吧,我将告诉你一件事,我将尝试在这里解释这一点。
Well I'm going to tell you something one time and I'm going to try to explain this all right here.
当您创建 HDMI 时,不要依赖 HDMI 来控制您的逻辑,您的 PLCC 使用 HDMI 将信息发送到大海中。
When you're creating HDMI is don't rely on the HDMI to control your logic and your PLCC use the HDMI to send information into the sea.
但让 PLCC 来做所有的工作。
But let the PLCC do all of the work.
因为如果 PLCC 依赖于 HDMI,那么如果 HDMI 中断或 PRC 和 HDMI 之间的网络中断,那么在运行您的进程时可能会发生更多事情。
Because if the PLCC is dependent upon the HDMI then if the HDMI breaks or the network between the PRC and the HDMI breaks there that many more things that can happen to run your process.
但是,如果 HDMI 实际上只是偶尔通过向 PRC 发送信息来进行交互,并且 PLCC 操作的形状或形式完全不依赖于我的年龄,那么其他一切都可能会失败。
But if the HDMI really just occasionally interacts with the PRC by sending it information and the PLCC operation is in no way shape or form dependent upon the age of my then everything else can fail.
但是只要 PLCC 正常工作,那么你的流程就会没问题,无论你在我这个年纪卸载了多少,如果 PRC 宕机,流程都会被破坏,所以你还不如把所有的鸡蛋都放进去集中在一个篮子中,而不依赖于 PC 之外的其他设备进行操作。
But as long as the PLCC is working then your process is going to be fine and no matter how much you unload on the age of my the the process is ruined anyway if the PRC goes down so you might as well just put all of your eggs in one basket and not depend on other devices outside of your PC for operation.
我要说的是使用按钮的时候。
I'm going to say when it comes to using buttons.
确实,我不喜欢使用切换开关。
Really I don't like to use toggles.
我不喜欢使用 set on 或 set off。
I don't like to use set on or set off.
我真的只喜欢使用按钮作为瞬间向我发送信号并让我知道操作员想要做什么。
I really only ever like to use a push button as a momentary on send me a signal and let me know what the operator wants to do.
在 PLCC 中我将处理该信号。
And in the PLCC I will handle that signal.
我会注意逻辑。
I will take care of the logic.
我将更改启动周期的状态。
I will change the status of the start the cycles.
我将在 PLCC 内部完成我需要做的所有事情,但我不需要依赖 HDMI 来为我设置和保持位。
I'll do everything I need to do inside of the PLCC but I do not need to depend on an HDMI to set and hold a bit for me.
好的,我已经完成了。
Ok so I'm done with that.
请牢记这一点。
Take that to heart.
这会让你的 APRC 项目比那些依赖年龄的人好得多。
It's going to make your APRC programs a whole lot better than people who depend on the age him-I.
因此,让我们继续并单击“确定”。
So let's go ahead and click OK.
现在我们有一个按钮,我们应该能够按下它来向我们的 PRC 发送一些信息,您可以看到我们还有开关,开关基本上就像使用按钮作为切换一样。
And now we've got a button that we should be able to press to send some information to our PRC and you can see we also have switches and switches are going to be basically like using push button as a toggle.
再说一遍,我真的不建议这样做。
And again I don't really recommend doing that.
所以它的开关看起来很漂亮,你可以说哦,哇,你知道看起来有多好,我可以让我的 HDMI 看起来像一个电气控制面板。
So it switches look pretty and you can say oh wow you know look how good that looks I can make my HDMI look like an electrical control panel.
理论上你可以,但不能。
Well theoretically you could but don't.
它不会让你的控制变得更好。
It's not going to make your controls better.
它不会让你的程序运行得更好。
It's not going to make your program run any better.
所以开关就在你身边。
So the switches are there for you.
有一些选择,但我建议在编程中真正使用它们吗?
There are options but do I recommend really using them in programming that way.
不是特别。
Not particularly.
我们有单选按钮 指示器按钮 指示器按钮有一半用处。
We have radio buttons indicator buttons indicator buttons are halfway useful.
所以,如果我想要保罗,让我们继续使用这些蓝色的之一。
So if I wanted to Paul let's go ahead and use one of these blue ones.
如果我现在将其拉到此处,我不仅有按钮标签名称,而且还有指示灯标签名称。
If I pull this in here now I not only have the push button tag name but I also have an indicator light tag name.
这个按钮有两种不同的作用。
This push button works as two different things.
它既可以作为控制,也可以作为指示器。
It works as in control and it also works as an indicator.
因此,我可以按一个按钮,它会说打开系统,但随后我将有另一个与该按钮完全分开的位,这实际上表明系统正在运行,我可以在这里参考这两个位所以我可以说按钮就在这里。
So I can push one push button and it'll say turn the system on but then I'll have another bit completely separate from that push button which will actually indicate that the system is running and I can refer to both of those bits right here so I can say well the push button is here.
指示器就在这里,在按下启动按钮和系统实际启动之间可能会发生五秒钟的过程。
The indicator is here and maybe there's a five second process that happens in between pushing the start button and the system actually coming on.
因此,在我的 HMO 上,当我按下该按钮时,一开始什么也不会发生,然后五秒钟后,照明器会改变颜色或开始闪烁,或者我告诉它做的任何事情,这是一个非常酷的工具,而且不是每个 HDMI 中都有的东西开发套件。
So on my HMO when I push that button at first nothing will happen and then five seconds later it will illuminator change colors or start blinking or whatever I tell it to do that is a pretty cool tool and it's not something that you have in every HDMI development suite.
我将继续取消它,因为我们暂时不打算使用它。
I will go ahead and cancel out of that because we're not going to use that for the moment.
但我确实想让您了解这些指示器按钮,因为这些按钮非常有用。
But I did want to make you aware of these indicator buttons because those yes those are pretty useful.
这是一个三态开关,看起来非常适合处理 H.O.
Here's a tri state switch which looks like something that would be great for handling H.O.
方式,但我再次不喜欢依赖我的 HDMI 来设置信息。
ways and it would but again I don't like to depend on my HDMI for setting information.
这可行,但也许坚持使用标准按钮,为了控制数字输入,您需要了解一件事。
This would work but maybe stick with standard pushbuttons here's one thing that you will need to know for controls your numeric entry.
这就是您将用于设置点的内容。
This is what you're going to be using for your set points.
那么让我们继续为此设置一个标签。
So let's go ahead and set a tag for this.
这就是我们的模式。
And that's where we've got our mode.
所以我们将继续采取这一点,你可以设置。
So we'll go ahead and take that and you can set.
你可以把她的显示器放在这里有多大。
How big of a number you can put her display on here.
因此,我将继续将文本大小增加到 10 位数字,我会说只显示 3 位数字。
So text size I'll go ahead and bump that up to 10 number of digits I'll say only show me 3 digits.
我想要小数点吗?
Do I want any decimal points.
嗯,不,因为这是一个整数,而整数不能处理小数点为 1 的前导空格是前导零。
Well no because this is an integer and integers can't handle decimal points to 1 in the leading spaces are leading zeros.
现在我宁愿有空格,也不愿屏幕上出现一堆零。
Now I'd rather have spaces than a bunch of zeros appearing all over the screen.
我这里有这个数据类型,我将把它保留为无符号十进制。
And I've got this data type right here which I am going to leave this as unsigned decimal.
然后是我的范围。
And then my range.
好吧,因为我只显示三个位置,假设我的范围是从 0 到我不知道,假设是 255,这样我就不会被数字和九个百冲昏头脑,只需点击“确定”即可。
Well since I'm only displaying three places let's say my range is going to be from 0 to I don't know let's say 255 that way I don't get carried away with numbers and the nine hundreds and just hit OK there.
所以这应该让我真正设定一个数字。
So that should let me actually set a number.
这是两个最流行的控件。
And these are the two most popular controls.
显然,这两种都有很多不同的风格。
Obviously there are a lot of different styles for both of those for instance.
做同样的工作看起来怎么样?
How does that look for doing the same job.
让我们继续将其连接到模式。
Let's go ahead and connect that up to mode.
我也会做同样的事情。
I will do the same thing.
我会将其设置为 14。
I'll set this one up to 14.
我将给它相同的范围 0 到 255。
I'll give it the same range of 0 to 255.
显示 3 位数字并点击。
Show 3 digits and hit.
好的。
OK.
你知道我认为我喜欢那个比我喜欢那个要好得多。
You know what I think I like that one a whole lot better than I like that one.
但无论如何,让我们模拟一下并看看这些控件是如何工作的。
But anyway let's simulate and see how these controls work.
所以这里我们有我们的。
So here we have our.
不是真的,而是想象中的 PLCC,我们正在这里监控我们的标签。
Not really but imaginary PLCC and we're monitoring our tags right here.
每当我达到这个状态时,你就可以看到我的赌注是塔加隆。
Whenever I hit this status you can see right there my bet is tagalong.
所以现在它打开了,它又关闭了,这就是瞬时的工作原理。
So now it's on now it's off and that's how momentary works.
当你握住它时,它会通电,当你松开它时,它就会断电。
While you're holding it it's energized when you let it go it de-energize this.
然后我们的两个数字条目上都有零。
And then we have zeros on both of our numeric entries.
因此,让我们继续单击其中一个并尝试输入旧的 6 6 6。
So let's go ahead and click on one of those and try to put in good old 6 6 6.
不幸的是,这里看到它说 in-tree 太高了。
And unfortunately here look at that it says in-tree is too high.
嗯,这是正确的,因为我们将范围设置为 0 到 255。
Well that's right because we set the range from 0 to 255.
那么我们尝试输入 200。
So let's try putting in 200.
果然现在变成了 200。
And sure enough now that changes to 200.
由于两者都是相互关联的,它们的历史都可以追溯到 200 年,而且它们的工作原理完全相同。
And since both of these are linked they both have dated to 200 and they work exactly the same.
它们只是看起来不同,这对于这个应用程序来说是件好事,因为 Seymour 确实为您提供了许多可以使用的不同模板和视觉样式。
They just look different which is kind of nice about this application because Seymour does give you a lot of different templates and visual styles that you can work with.
因此,当谈到在屏幕上创建控件时,这真的非常简单。
So when it comes to creating controls on your screen it's really pretty simple.
通常,您需要输入的只是一个数值,几乎总是整数。
Usually all you're going to have to be putting in is going to be a numeric value almost always an integer.
您知道向瞬时按钮发送数字信号。
And you know sending in a momentary pushbutton a digital signal.
现在你知道如何做到这一点。
And as of right now you know how to do that.
您知道如何将它们链接到标签。
You know how to link those up to tags.
您知道如何创建这些标签来引用 APRC 内部的正确内存。
And you know how to create those tags to reference the correct memory inside of APRC.
所以,如果这就是我和你们谈论 HDMI 的全部内容,然后我结束了这门课程,收拾好行李,去了迪士尼乐园。
So if that was all I ever talk to you about HDMI and then I wrapped up this course packed up my bags and went to Disneyland.
您已经了解了足够的知识来弄清楚其余部分并创建 HDMI 眼睛。
You already know enough to figure out the rest and create HDMI eyes.
但别担心,我们还会去更多的地方,我们有大量的开放水域可供覆盖,所以你现在已经掌握了基础知识,但我们将完善这些知识,让你变得更聪明。
But don't worry we're gonna go a lot more we've got plenty of open water to cover so you've got the basics now but we're going to refine those and get you a lot smarter.
这就是控件的真正用途。
So that's really it for controls.
如果您浏览此处,您会发现还有许多其他类型的控件可供使用。
If you look through here you're going to see there are plenty of other types of controls that you can use.
尝试一下这些。
Experiment with those.
使用这些工具,但我不会让您花几个小时创建所有不同的工具并向您展示每个工具的所有不同选项,让您感到无聊。
Use those but I'm not going to bore you for hours and hours and hours creating all the different tools and showing you all the different options for every single one.
基本的就是将工具放入标签中,您就知道摇滚乐了。
The basic is dropped the tool put in the tag and you know rock and roll.
所以你知道你可以自己做到这一点,而且这里的 90% 的东西实际上你永远都不需要使用。
So you know you can do that on your own and really 90 percent of the things in here you're never going to need to use anyway.
我将在这里向您展示另一件很酷的东西,那就是滑块。
I will show you one more cool thing here and that is a slider.
这是您设置模式的另一种方式。
So one more way that you could set your mode.
我不会对其进行太多格式化。
I'm not going to really format this a lot.
我将直接跳进去进行模拟。
I'm just going to jump right in and simulate.
现在我们开始。
And here we go.
因此,如果我们想更改该值,只需滑动滑块即可。
So if we wanted to change the value we could just slide a slider.
这对于控制浮点数和整数也非常有用。
And that's also really good for controlling floats as well as integers.
您可以在这里看到数字正在变化。
And you can see here the numbers are changing.
我们继续逃吧。
Let's go ahead and escape.
有吗,但就是这样。
Are there but yeah that's it.
这就是我现在要向您提供的有关控件的全部内容。
So that's all I'm going to give you on controls for now.
当我们介绍其他技术时,我将向您展示更多的控件。
I'm going to show you more controls as we go through other technologies.
但现在我只是想让你对西摩有一个真正基本的了解。
But right now I'm just trying to give you a really basic familiarity with Seymour.
这就是控件。
That's it for controls.
我们将在接下来的讲座中查看展示。
We'll look at displays in the next lectures see then.
欢呼吧。
And cheers.